package sdk.webview.fmc.com.fmcsdk.check.adapter;


import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

import sdk.webview.fmc.com.fmcsdk.R;
import sdk.webview.fmc.com.fmcsdk.check.bean.RunListPagerBean;
import sdk.webview.fmc.com.fmcsdk.imagepicker.utils.Utils;
import sdk.webview.fmc.com.fmcsdk.util.StringUtils;

public class DeviceHealthCardAdapter extends BaseQuickAdapter<RunListPagerBean.RecordsDTO, BaseViewHolder> {
    public DeviceHealthCardAdapter(@Nullable List<RunListPagerBean.RecordsDTO> data) {
        super(R.layout.item_device_health_card, data);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder holder, RunListPagerBean.RecordsDTO item) {
        if ((getData().size() - 1) == holder.getAdapterPosition()) {
            holder.getView(R.id.iv_line).setVisibility(View.GONE);
            holder.getView(R.id.iv_line_last).setVisibility(View.VISIBLE);
        } else {
            holder.getView(R.id.iv_line).setVisibility(View.VISIBLE);
            holder.getView(R.id.iv_line_last).setVisibility(View.GONE);
        }

        holder.setGone(R.id.tv_look_detail, (item.getType().equals("4") || item.getType().equals("5") ||
                item.getType().equals("7") || item.getType().equals("8")) && !StringUtils.isEmpty(item.getRefId()));
        holder.setText(R.id.tv_time, Utils.getTimeMDHMS(item.getOperateDate()))
                .setText(R.id.tv_result, item.getRemark())
                .setText(R.id.tv_status, item.getOperateTypeName());



    }

}
